<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> 
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<!-- <meta http-equiv="refresh" content="2" /> -->
	<title>图片详细信息</title>
	<!--[if lt IE 9]>
		<script src="<%=basePath %>js/ie9.js"></script>
	<![endif]-->
	<link rel="icon" href="<%=basePath %>images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<%=basePath %>images/favicon.ico" type="image/x-icon" />
	<script src="<%=basePath %>js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/jquery.cookie.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/cookie.save.js"></script>
	<script src="<%=basePath %>js/sign-up.js"></script>
	<script type="text/javascript" src="<%=basePath %>inc/kindeditor/kindeditor-min.js"></script>
	<link href="<%=basePath %>css/details.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<%=basePath %>js/jquery.shareList.js"></script>
  	<link href="<%=basePath %>css/base.css" rel="stylesheet" type="text/css" />
  	<link href="<%=basePath %>css/shareList.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript">
 $(function() {
	 $("#share").shareList();
 });
 </script>
<script>
var editor;
KindEditor.ready(function(K) {
	editor = K.create('textarea[name="message.content"]', {
		resizeType : 1,
		allowPreviewEmoticons : false,
		allowImageUpload : false,
		width: 450, 
		height: 30,
		newlineTag : 'br',
		items: ['fontname', 'fontsize', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'emoticons', 'link']
	});
});
</script>
</head>
<body>
	<div id="header">
		<div class="header-content">
			<h1 class="logo">
				<a href="<%=basePath %>jsp/index.jsp">photobucket</a>
			</h1>
			<a href="<%=basePath %>jsp/upload.jsp" class="nav-upload">上传</a>
			<input type="hidden" name="page" value="1"/>
			<form action="pictureAction!findByKeyWord" class="search" method="post">
				<div class="search-group">
					<input type="text" name="keyWord" class="field style" value="用户名、图片类别"/>
					<input type="submit" title="Submit" value="" class="submit" />
				</div>
			</form>
			<div class="login">
				<c:if test="${sessionScope.loginUser == null}">
					<div class="sign-in">
						<a href="javascript:void(0);">登录</a><a href="<%=basePath %>jsp/signup.jsp">注册</a>
					</div>
				</c:if>
				<c:if test="${sessionScope.loginUser != null}">
					<div class="show-user">
						<img src="<%=basePath %>${sessionScope.loginUser.photoSticker}" width="30" height="30"/>
						<a href="userAction!findById?user.id=${sessionScope.loginUser.id}">${sessionScope.loginUser.userName}</a>
					</div>
				</c:if>
				<div class="loginbox" style="display: none;">
					<span class="angle"></span>
					<a href="#" class="close">x</a>
					<form action="userAction!signin" class="login-form" method="post">
						<div class="input-group">
							<label for="username">用户名</label>
							<input type="text" name="user.userName" id="username" class="username" />
						</div>
						<div class="input-group">
							<label for="password">密码</label>
							<input type="password" name="user.password" id="password" class="password" />
						</div>
						<div class="input-group ">
							<input type="checkbox" name="checkbox" id="checkbox" class="checkbox"/>
							<small>记住我</small>
							<input type="submit" title="Login" value="登录" class="Login" />
						</div>
						<div class="login-info">
							<p>还没有登录账号？<a href="<%=basePath %>jsp/signup.jsp">立即注册</a></p>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div> <!-- header -->
	<div class="content">
		<div class="content2">
			<div class="main">
				<a href="javascript:history.go(-1);" class="follow">
					返回
				</a>
				<div class="main-content">
					<div class="small-navigate" id="share">
					</div>
					<img src="<%=basePath %>${picture.url}" alt="${picture.picName }" id="img"/>
					<div class="titlecontainer">
						<span>${picture.picName }</span>
					</div>
					<div class="titlecontainer">
						<img src="<%=basePath %>${picture.user.photoSticker }" alt="profile" class="profile" />
						<a href="pictureAction!findForPage?picture.user.id=${picture.user.id }&page=1"">${picture.user.userName }</a>
					</div>
					<div class="commentcontainer">
						<h5 class="commenttitle">
							评论 (${fn:length(picture.messages)})
						</h5>
						<div class="comments">
							<form action="messageAction!add" class="postcomment" method="post">
								<img src="<%=basePath %>images/profile.jpg" alt="profile" class="imgcss"/>
								<input type="hidden" value="${sessionScope.loginUser.id }" name="message.user.id"/>
								<input type="hidden" value="${picture.id }" name="message.picture.id"/>
								<textarea name="message.content" id="message.content" class="clearBoth addContent"></textarea>
								<c:if test="${sessionScope.loginUser == null}">
									<input disabled="disabled" type="submit" value="提交" class="disable"/><label class="dislogin">登录后才可以进行评论</label>
								</c:if>
								<c:if test="${sessionScope.loginUser != null}">
									<input type="submit" value="提交" class="post" />
								</c:if>
							</form>
							<c:forEach items="${picture.messages}" var="message">
								<div class="comment">
									<img src="<%=basePath %>${message.user.photoSticker }" class="imgcss" alt="profile" />
									<div class="comment-content">
										<a href="#">${message.user.userName }</a>
										<div class="comment-main">
											<c:out value="${message.content }" escapeXml="false"></c:out>
										</div>
										<br />
										<div class="comment-time">
											<fmt:formatDate value="${message.publishTime }" pattern="yyyy/MM/dd HH:mm:ss"/>
										</div>
									</div>
								</div> <!-- comment -->
							</c:forEach>
						</div>
					</div>
				</div> <!-- main-content -->
			</div> <!-- main -->
			<div class="categories">
				<h5>便笺</h5>
				<ul>
					<li><a href="userAction!findById?user.id=${sessionScope.loginUser.id }">个人信息</a></li>
					<li><a href="<%=basePath %>jsp/modifysticker.jsp">修改头像</a></li>
					<li><a href="<%=basePath %>jsp/upload.jsp">上传图片</a></li>
					<c:if test="${sessionScopt.loginUser == null}">
						<li><a href="pictureAction!findForPage?picture.user.id=${sessionScope.loginUser.id }&page=1">个人图片</a></li>
					</c:if>
					<li><a href="pictureAction!findForPage?picture.user.id=${picture.user.id }&page=1">该作者所有图片</a></li>
					<li><a href="pictureAction!findAll?page=1">所有图片</a></li>
					<c:if test="${sessionScope.loginUser != null}">
						<li><a href="userAction!logout">安全注销</a></li>
					</c:if>
				</ul>
			</div> <!-- categories -->
			<div class="whatisnew">
				<img src="../images/whatisnew.jpg" alt="whatisnew" />
				<div class="info">
					<h5>Edit Your Photos</h5>
					<p>Create all kinds of amazing special effects with our free, built-in image editor. Create color splash, cartoon, pop art effects, and much more!</p>
					<a href="#">Check it out</a>
				</div>
			</div> <!-- whatisnew --></div>
			<div class="bottom-clear">
			</div>
	</div> <!-- contetn -->
	<div class="footer">
		<div class="footer-content">
			<p>Copyright 2012 Sharelife.  All rights reserved.  |   <a href="#">Privacy policy</a>  |   <a href="#">Terms of use</a>  |   <a href="#">Site map</a></p>
		</div>
	</div>
</body>
</html>